package controller;

import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import service.LukeService;
import service.OrderService;

@Path(value = "/admin/myrecord", viewPath = "/pages")
@RequiresAuthentication
public class MyRecordController extends Controller {

    LukeService lukeService = new LukeService();

    public void index(){
        render("my-luke-list.html");
    }

    public void list(){
        int page=getInt("page");
        int size=getInt("limit");
        setAttr("datas",lukeService.getMyRecordByPage(page,size));
        setAttr("erro",0);
        renderJson();
    }

    public void changestate(){
        String id=get("id");
        if(lukeService.changeState(id)){
            setAttr("erro",0);
        }else{
            setAttr("erro",-1);
        }
        renderJson();
    }
}
